import Request from '../index'

import { IAccout, ILoginResult } from './type'
import { ILoginType } from '../types'

enum LoginApi {
  AccoutLogin = '/login',
  loginUserInfo = '/users/',
  UserMenus = '/role/'
}

export function accoutLoginRequest(accout: IAccout) {
  return Request.post<ILoginType<ILoginResult>>({
    url: LoginApi.AccoutLogin,
    data: accout
  })
}

export function reqeustUserInfoById(id: number) {
  return Request.get<ILoginType>({
    url: LoginApi.loginUserInfo + id
  })
}

export function requestUserMenuByRoleId(id: number) {
  return Request.get<ILoginType>({
    url: LoginApi.UserMenus + id + '/menu'
  })
}
